import Vue from 'vue'
export default {
    question(v,n) {
        return Vue.prototype.$http({
            url: 'https://api.openai.com/v1/completions',
            method: 'post',
            data: {
                "model": "text-davinci-003", "prompt": v, "temperature": 0, "max_tokens": n,suffix:'code'
            },
            headers: {
                'Authorization': localStorage.Authorization || process.env.VUE_APP_SESSION_TOKEN,
                'Content-Type': 'application/json'
            }
        })
    },
    testToken(d) {
        return Vue.prototype.$http({
            url: 'https://api.openai.com/v1/models',
            method: 'get',
            headers: {
                'Authorization': localStorage.Authorization || process.env.VUE_APP_SESSION_TOKEN,
                'Content-Type': 'application/json'
            }
        })
    }
}